package com.runvp.common.pay.adapay.demo;

import com.huifu.adapay.AdaPay;

/**
 * @author jane.zhao
 */
public class MainDemo {
    public static void main(String[] args) throws Exception {
        //apiKey，商户联调用
        String apiKey = "api_test_927dac45-6013-439b-ad1e-338258d5bb56";
        //apiKey，真实交易用（live）
        String apiKeyLive = "api_live_48427a29-0091-4ca3-82b2-11fd39891b20";
        //公钥 Adapay RSA 公钥
        String pubKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCwN6xgd6Ad8v2hIIsQVnbt8a3JituR8o4Tc3B5WlcFR55bz4OMqrG/356Ur3cPbc2Fe8ArNd/0gZbC9q56Eb16JTkVNA/fye4SXznWxdyBPR7+guuJZHc/VW2fKH2lfZ2P3Tt0QkKZZoawYOGSMdIvO+WqK44updyax0ikK6JlNQIDAQAB" ;
        //私钥 商户私钥
        String privateKey= "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAIlSS6Agsv43Xn4OF6vabKrz7Us3JRMT2ZaFj+2CsoQ3Javn2CoWJ0O0grR9TpA+8DUUBC9jOz8aG9x2EKoe2ZSmNocG7poQUdO4+IeotM4gBssPdFy9HsN0xom2qRpcbQNPAS8yscp/7DwOlvYjKhh0eluRLfNbDyEFLxZz61TRAgMBAAECgYBMMC2nTR0iMIQruhPmFEzgWG/aoGDggc3iVn4xT6dN9e7fvsVPLHVieh9elntlSpYpTM65n/u6GflFSvgZ+v3KTJFu3kvxVuR6aCIF5tf0siiWyYjeQew/npxxbUI0CEW3VIFV+88+ma+CUA/zFCYMO8JvAMuitynHzXCoiXm4hQJBAL1gO17ULEGyvkVkojTKOyGH5tkADd16Hymp0YJgxAa6/OJ7oRCN65+Ppb5m2dMB4FtNitBhy0yEeuPhTv4N17cCQQC5oeIF0iAdwg8W74c+on1ZzVK4PdSBA94udPU/X7zj+Mj3OqlveLLm4WKhweeNA67ohwjCPksrU6YSfMK4oOe3AkBGbx9F0tYvDUL1XktyJPE/NGOou/tsL3qdrVqOCl1+P1fFCMRL+uzy6KN1oJ1NfLosWzfQ7z6E1BU84lTV6uIbAkEAkp7em6JgY6DHsmH2/O3y/F9EmumbU1vuvdr7atb/p0D12vCmq7k19U7ITOOPNL5YBKnDrUjuroYfgjKwyous+QJAFm3Z6W6OuCvnfo2gRE4Mm223F+L5FtfLpQKi8fUXaffhrQuJbkAQxGL65ONBJB2luUwdnz1QPkMAzo67v5erZA==" ;

        //设置AdaPay全局参数，不同环境设置不同的apiKey/pubKey/privateKey
        AdaPay.apiKey = apiKeyLive;
        AdaPay.pubKey = pubKey;
        AdaPay.privateKey = privateKey;
        AdaPay.debug = false;

        //启动 mqtt 异步监听
        AdaPay.iNotifyCallback = new NotifyCallbackDemo();
        AdaPay.startNotifyListener();

        //test chargeId = "002112019080716223300005091372336111616";
        //运行支付类接口
        String chargeId = PaymentDemo.executePaymentTest();
        //运行退款类接口
        RefundDemo.executeRefundTest(chargeId);
    }
}
